<template>
    <fieldset>
        <legend>Child</legend>
        <h2>子组件</h2>
        <h3>礼物:{{ gift }}</h3>
        <button @click="send">点击传递给父组件</button>
    </fieldset>
</template>
<script>
import bus from "../utils/bus"
export default {
    mounted() {
        bus.$on('receive', (input) => {
            console.log(input)
        })
    },
    props: ['gift'],
    data() {
        return {
            book: "钢铁是怎样练成的"
        }
    },
    methods: {
        send() {
            this.$emit('re', this.book)
        }
    }
}
</script>